package com.jinlejia.erp.lab;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.jinlejia.erp.ui.common.WebViewActivity;
import com.jinlejia.erp.ui.customer.DetailCustomerActivity;
import com.jinlejia.erp.ui.customer.PushFollowUpActivity;
import com.jinlejia.erp.ui.home.AppVisitDetailsActivity;
import com.jinlejia.erp.ui.home.AppointmentVisitActivity;
import com.jinlejia.erp.ui.home.NoticeDetailActivity;
import com.jinlejia.erp.ui.house.HouseDetailActivity;
import com.jinlejia.erp.ui.mine.actual.ActualSurveyActivity;
import com.jinlejia.erp.ui.mine.assist.AssistAignatureActivity;
import com.jinlejia.erp.ui.mine.assist.AssistInfoActivity;
import com.jinlejia.erp.ui.mine.contract.AuditLoginActivity;
import com.jinlejia.erp.ui.mine.contract.MyContractDetailsActivity;
import com.jinlejia.erp.ui.mine.contract.MyIntoActivity;
import com.jinlejia.erp.ui.mine.transfer.DetailTransferActivity;
import com.lab.push.MainPushProtocol;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class MainPushMessageProtocol implements MainPushProtocol {

    @Override
    public void sendMainPush(@NotNull Context context, @Nullable String code, @Nullable String link) {
        if (TextUtils.isEmpty(link))return;
        Intent mIntent = null;
        switch (link) {
            case "customerbasic":   //买卖客源详情
                mIntent = new Intent(context, DetailCustomerActivity.class);
                mIntent.putExtra("type", "sale");
                mIntent.putExtra("csCode", code);
                break;
            case "rentcustomerbasic"://租赁客源详情
                mIntent = new Intent(context, DetailCustomerActivity.class);
                mIntent.putExtra("type", "rent");
                mIntent.putExtra("csCode", code);
                break;
            case "appoinmentdetails"://约看详情
                mIntent = new Intent(context, AppVisitDetailsActivity.class);
                mIntent.putExtra("appointmentCode", code);
                break;
            case "appoinmentlist"://约看列表
                mIntent = new Intent(context, AppointmentVisitActivity.class);
                break;
            case "showroomlist"://带看列表
                mIntent = new Intent(context, DetailCustomerActivity.class);
                break;
            case "shsbasicdetails"://买卖房源详情
                mIntent = new Intent(context, HouseDetailActivity.class);
                mIntent.putExtra("type", "shs");
                mIntent.putExtra("code", code);
                break;
            case "rentbasicdetails"://租赁房源详情
                mIntent = new Intent(context, HouseDetailActivity.class);
                mIntent.putExtra("type", "rent");
                mIntent.putExtra("code", code);
                break;
            case "pactdetails"://合同详情
                mIntent = new Intent(context, MyContractDetailsActivity.class);
                mIntent.putExtra("contractCode", code);
                break;
            case "noticedetails": //公告详情
                mIntent = new Intent(context, NoticeDetailActivity.class);
                mIntent.putExtra("id", code);
                break;
            case "userbdapplydetails": //打开异动申请详情页
                mIntent = new Intent(context, DetailTransferActivity.class);
                mIntent.putExtra("userbdCode", code);
                mIntent.putExtra("isAudit", false);
                break;

            case "userbdauditdetails": //打开异动审核详情页
                mIntent = new Intent(context, DetailTransferActivity.class);
                mIntent.putExtra("userbdCode", code);
                mIntent.putExtra("isAudit", true);
                break;
            case "cooperationtails": //打开协助签单详情页
                mIntent = new Intent(context, AssistInfoActivity.class);
                mIntent.putExtra("id", code);
                break;
            case "cooperationlist": //打开协助签单列表页
                mIntent = new Intent(context, AssistAignatureActivity.class);
                break;
            case "openapp":
                break;
            case "openappnodetails":
                break;
            case "myCommissions": //打开我的分成
                mIntent = new Intent(context, MyIntoActivity.class);
                break;
            case "mysurvey": //打开我的实勘
                mIntent = new Intent(context, ActualSurveyActivity.class);
                break;
            case "shsfollowprice": //打开买卖跟进价格页面
                mIntent = new Intent(context, PushFollowUpActivity.class);
                mIntent.putExtra("type", "sale");
                mIntent.putExtra("rscode", code);
                break;
            case "rentfollowprice": //打开租赁跟进价格页面
                mIntent = new Intent(context, PushFollowUpActivity.class);
                mIntent.putExtra("type", "rent");
                mIntent.putExtra("rscode", code);
                break;
            case "loginapply": //打开登录审核
                mIntent = new Intent(context, AuditLoginActivity.class);
                mIntent.putExtra("id", code);
                break;
            default:
                mIntent = new Intent(context, WebViewActivity.class);
                mIntent.putExtra("url", link);
                break;
        }
        if (null != mIntent) {
            context.startActivity(mIntent);
        }
    }
}
